package com.forlove.app.common.base;

import android.content.Context;
import android.os.Environment;

import java.io.File;

/**
 * 基础通用配置
 * Created by yjl on 2017/9/25.
 */

public class CommonConfig {
    public final static String DEFAULT_FOLDER = "ForLove";

    public static boolean LogEnable = true;

    public static final String FILE_NAME = "forlove_config";

    //控制是否打印log
    public static boolean getLogEnable() {
        return LogEnable;
    }

    public static void setLogEnable(boolean enable) {
        LogEnable = enable;
    }

    public static final String pmFolder = DEFAULT_FOLDER + File.separator;

    //app 的文件默认路径，需要存储权限
    public static final String appSdPath = Environment.getExternalStorageDirectory()
            + File.separator + pmFolder;

    //app 下载路径
    public static final String pmSDCardDownloadDir = appSdPath + "download";

    //app 日志路径
    public static final String pmLogDir = appSdPath + ".log";

    //app 图片下载路径
    public static final String pmImageDir = appSdPath + "image";

    //app网络缓存
    public static final String pmCache = appSdPath + "cache";
    //字体路径
    public static final String FONT_FOLDER = Environment.getExternalStorageDirectory().getAbsolutePath()
            + File.separator + pmFolder + "/fonts";

    //不需要存储权限的app私有空间,文件会随app卸载而清除
    public static File getAppFilePath(Context appContext) {
        File file = appContext.getExternalFilesDir(pmFolder);
        return file;
    }


    public static final String DOWNLOAD_URL_NAME = "dest_url";
    public static final String DOWNLOAD_FILE_NAME = "dest_file";
    public static final String CALLBACK_ACTION_NAME = "call_action";
    public static final String CALLBACK_EXTRA_NAME = "call_extra";
    public static final String CALLBACK_DOANLOAD_CONDITION = "network_condition"; //下载的网络条件的标志

    public static final String DOWNLOAD_RESLUT = "download_result"; //传送接受下载结果的标识
    public static final String RESULT_DOWLOAD_SUCCESS = "download_success";//下载结果成功
    public static final String RESULT_DOWLOAD_FAIL = "download_fail";//下载失败

    public static final String DOWNLOAD_FILE_SIZE = "download_file_size"; //下载文件大小标志

    public static final String DOWNLOAD_CONDITION_WIFI = "WIFI";//WIFI
    // public static final String DOWNLOAD_CONDITION_4G = "4G";//4G 和WIFI都可以下载
    public static final String DOWNLOAD_CONDITION_CONNECTION = "CONNECTION";//网络可用状态

    //public static final String SILENT_PLUGIN_VERSION = "1.0.0";

    public static final long LAST_DOWNLOAD_ERROR_TIME = 2 * 3600 * 1000L;
//    public static final String appSdPath = Environment.getExternalStorageDirectory()
//            + File.separator + pmFolder;

    public static final String DOWNLOAD_PATH = appSdPath + "download" + File.separator; //下载路径
}
